package com.joelaws.prototype.client.rpc;

import java.util.List;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.joelaws.prototype.client.data.Message;

public interface Messaging extends RemoteService {

	public static final String SERVICE_URI = "/Messaging";

	public static class Util {

		public static MessagingAsync getInstance() {

			MessagingAsync instance = (MessagingAsync) GWT.create(Messaging.class);
			ServiceDefTarget target = (ServiceDefTarget) instance;
			target.setServiceEntryPoint(GWT.getModuleBaseURL() + SERVICE_URI);
			return instance;
		}
	}

	public List<Message> getFromMessages(long user) throws Exception;

	public List<Message> getToMessages(long user) throws Exception;

	public void storeMessage(Message message) throws Exception;

}
